//
//  SendPresentViewController.m
//  LiveStar
//
//  Created by 漪珊 on 2016/12/15.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "SendPresentViewController.h"
#import "SendPresentCell.h"

@interface SendPresentViewController ()<UITableViewDelegate,UITableViewDataSource>{
    NSMutableArray *_sendPresentArray;
}
@property (nonatomic, strong) UITableView *tableView;
@end

@implementation SendPresentViewController
#pragma mark -- 发送礼品记录
- (void)sendPresentRequest {
    NSDictionary *dict = @{@"udid":User_ID,
                           @"token":TOKEN,
                           @"suid":self.suid,
                           @"type":@"",
                           @"page":@"1"
                           };
    NSString *urlString = [TEST_URL stringByAppendingString:kFStarSendList];
    [self showHUDInView:self.view title:nil];
    [NetworkTools postReqeustWithParams:dict UrlString:urlString successBlock:^(id responseObject) {
        [self hideHUD];
        if ([responseObject[@"code"] intValue] == 200) {
            
        }
    } failureBlock:^(NSError *error) {
        [self hideHUD];
    } showHUD:NO];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    [self sendPresentRequest];
    [self setNav];
    [self setUpUI];
    // Do any additional setup after loading the view.
}

- (void)setNav {
    self.navigationItem.title = @"送出的礼物";
}
#pragma mark -- UI
- (void)setUpUI {
    _sendPresentArray = [NSMutableArray arrayWithCapacity:1];
    //tableView
    [self creatTableView];
    
}

- (void)creatTableView {
    self.tableView = [[UITableView alloc] init];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
}

#pragma mark -- tableView 代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    SendPresentCell *cell = [SendPresentCell loadNibCellWithTabelView:tableView];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

#pragma mark -- 区头视图

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 180.5;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
